package com.deyou.activity;

import android.animation.Animator;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.airbnb.lottie.LottieAnimationView;
import com.deyou.MainActivity;
import com.deyou.R;
import com.deyou.util.AndroidUtils;
import com.taobao.sophix.SophixManager;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SplashActivity extends AppCompatActivity {

    @BindView(R.id.lottie_view)
    LottieAnimationView lottieView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        ButterKnife.bind(this);

        Animator.AnimatorListener animatorListener = new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {
                AndroidUtils.startNextActivity(SplashActivity.this, MainActivity.class, null, true);
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                AndroidUtils.startNextActivity(SplashActivity.this, MainActivity.class, null, true);
            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        };

        lottieView.addAnimatorListener(animatorListener);
        lottieView.playAnimation();
    }
}
